/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ejb;

import ejb.facade.OrdineFacadeLocal;
import entities.Ordine;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;

/**
 *
 * @author sflesca
 */
@Stateless
public class OrderManager implements OrderManagerLocal {
    @EJB
    private OrdineFacadeLocal ordineFacade;

    @Override
    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
    public List<Ordine> getOrdini() {
        return ordineFacade.findAll();
    }

    
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")

    @Override
    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
    public Ordine getOrdineCompleto(Ordine ordine) {
        Ordine od =  ordineFacade.find(ordine.getId());
        od.getDettagli().size();
        return od;
    }
}
